From f79142a93df7741d697d0756b013d31cf2f0e436 Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Thu, 23 Feb 2006 15:59:54 +0000 Subject: [PATCH] Make the fixmap area moveable in kernel address space. From: Gerd Hoffmann Signed-off-by: Christian Limpach --- linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c | 12 ++++++++++++ .../include/asm-i386/mach-xen/asm/fixmap.h | 8 +++++--- .../include/asm-i386/mach-xen/asm/page.h | 2 +- .../include/asm-i386/mach-xen/setup_arch_post.h | 6 ++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c b/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c index 7a32295ec6..869d43ef89 100644 --- a/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c +++ b/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -184,6 +185,10 @@ void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags) __flush_tlb_one(vaddr); } +static int nr_fixmaps = 0; +unsigned long __FIXADDR_TOP = (HYPERVISOR_VIRT_START - 2 * PAGE_SIZE); +EXPORT_SYMBOL(__FIXADDR_TOP); + void __set_fixmap (enum fixed_addresses idx, maddr_t phys, pgprot_t flags) { unsigned long address = __fix_to_virt(idx); @@ -203,6 +208,13 @@ void __set_fixmap (enum fixed_addresses idx, maddr_t phys, pgprot_t flags) set_pte_pfn_ma(address, phys >> PAGE_SHIFT, flags); break; } + nr_fixmaps++; +} + +void set_fixaddr_top(unsigned long top) +{ + BUG_ON(nr_fixmaps > 0); + __FIXADDR_TOP = top - PAGE_SIZE; } pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h index 190bc2df59..a69d5bca5a 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h @@ -20,7 +20,7 @@ * Leave one empty page between vmalloc'ed areas and * the start of the fixmap. */ -#define __FIXADDR_TOP (HYPERVISOR_VIRT_START - 2 * PAGE_SIZE) +extern unsigned long __FIXADDR_TOP; #ifndef __ASSEMBLY__ #include @@ -98,8 +98,10 @@ enum fixed_addresses { __end_of_fixed_addresses }; -extern void __set_fixmap( - enum fixed_addresses idx, maddr_t phys, pgprot_t flags); +extern void __set_fixmap(enum fixed_addresses idx, + maddr_t phys, pgprot_t flags); + +extern void set_fixaddr_top(unsigned long top); #define set_fixmap(idx, phys) \ __set_fixmap(idx, phys, PAGE_KERNEL) diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h index a923361ea2..248743b8b6 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h @@ -294,7 +294,7 @@ extern int page_is_ram(unsigned long pagenr); #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) -#define MAXMEM (HYPERVISOR_VIRT_START-__PAGE_OFFSET-__VMALLOC_RESERVE) +#define MAXMEM (__FIXADDR_TOP-__PAGE_OFFSET-__VMALLOC_RESERVE) #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h index fa7d6191b1..acec1ac0f8 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h @@ -33,6 +33,8 @@ extern void nmi(void); static void __init machine_specific_arch_setup(void) { + struct xen_platform_parameters pp; + HYPERVISOR_set_callbacks( __KERNEL_CS, (unsigned long)hypervisor_callback, __KERNEL_CS, (unsigned long)failsafe_callback); @@ -40,4 +42,8 @@ static void __init machine_specific_arch_setup(void) HYPERVISOR_nmi_op(XENNMI_register_callback, (unsigned long)&nmi); machine_specific_modify_cpu_capabilities(&boot_cpu_data); + + if (HYPERVISOR_xen_version(XENVER_platform_parameters, + &pp) == 0) + set_fixaddr_top(pp.virt_start - PAGE_SIZE); } -- 2.30.2